home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / cmln0885.arc / CROSS3.LTG < prev    next >
Text File  |  1986-02-27  |  2KB  |  51 lines

  1. crossthoughts Listinτá 3.
  2.  
  3. PP╠ codσ fo≥ modified¼ least-frequently-useΣ (MLFU⌐ pagσ ì
  4. replacemen⌠ function
  5.  
  6.  
  7. FUNCTION Selected_Page() return integer
  8.  
  9. -- Critical_Timσ i≤ se⌠ a≤ ß criterioε fo≥ givinτ recentl∙ reaΣ ì
  10. page≤ ß seconΣ chancσ fo≥ staying«  I⌠ mus⌠ bσ systematicall∙ ì
  11. updateΣ by other program segments.
  12.  
  13. -- The modified Table_Type is
  14. -- Table_Type = RECORD RAM_Page, Dirty_bit, Frequency : integer; 
  15.                        Time : Time_Units END 
  16.  
  17. BEGIN
  18.     IF Found 
  19.     THEN   -- when sought page is RAM-resident
  20.         Table[i].Frequency += 1 
  21.         return ()
  22.     ELSE
  23.         INITIALIZE: Pick = 1
  24.         LOOP <Start_Up>
  25.         BEGIN For j = 1 to Table_Size 
  26.             IF Critical_Time > Table[j].Time 
  27.             THEN Least_Frequent = Table[j].Frequency
  28.                  Pick = j
  29.                  EXIT <Start_Up>
  30.             END IF
  31.         END LOOP <Start_Up>
  32.         TERMINATE: None
  33.  
  34.         INITIALIZE: Least_Frequent = Table[Pick].Frequency
  35.                     Pointer = Pick; j = Pick + 1
  36.         LOOP <Search>
  37.         BEGIN IF j > Table_Size THEN EXIT <Search> END IF
  38.             IF Least_Frequent > Table[j].Frequency AND
  39.                Critical_Time > Table[j].Time 
  40.             THEN Least_Frequent = Table[j].Frequency
  41.                  Pointer = j
  42.             ELSE j += 1
  43.             END IF
  44.         END LOOP <Search>
  45.         -- Prepare frequency count for new page
  46.         TERMINATE: Table[Pointer].Frequency = 1 
  47.         return( Pointer )
  48.     END IF
  49. END Selected_Page
  50.  
  51.